perm filename BACKTR.SG[DEN,LMM] blob sn#070820 filedate 1973-11-01 generic text, type T, neo UTF8
(FILECREATED "31-OCT-73 18:09:28" S-BACKTRACK)


  (LISPXPRINT (QUOTE BACKTRACKVARS)
              T)
  (RPAQQ BACKTRACKVARS ((FNS STKAPPLY* CURPOS USE REGENERATE GENERATE)
          (VARS (**GENERATEBLIP**)
                (**FOREACHPOS**)
                (**FOREACHBLIP**))
          (PROP CLISPWORD FOREACH)
          (PROP MACRO USE GENERATE REGENERATE FOREACH)))
(DEFINEQ

(STKAPPLY*
  [LAMBDA N
    (STKEVAL (ARG N 1)
             (CONS (ARG N 2)
                   (FOR I FROM 3 TO N COLLECT (KWOTE (ARG N I])

(CURPOS
  [LAMBDA NIL
    (STKARG 0 (QUOTE CURPOS])

(USE
  [LAMBDA (Z)
    (COND
      [(EQ (CAR **GENERATEBLIP**)
           (QUOTE **NOFOREACH**))
        (RPLACD **GENERATEBLIP** (CONS Z (CDR **GENERATEBLIP**]
      (T (STKAPPLY* **GENERATEPOS** **GENERATEBLIP** Z])

(REGENERATE
  [NLAMBDA (**REGENFORM**)
    (FOREACH **REGEN**(EVAL **REGENFORM**)
             (USE **REGEN**])

(GENERATE
  [NLAMBDA GENERATEFORM
    (PROG ([**GENERATEBLIP**(OR **FOREACHBLIP** (CONS (QUOTE 
                                                      **NOFOREACH**]
           (**FOREACHBLIP**)
           (**GENERATEPOS** **FOREACHPOS**)
           (**FOREACHPOS**))
          (EVAL (CONS (QUOTE PROGN)
                      GENERATEFORM))
          (AND (EQ (CAR **GENERATEBLIP**)
                   (QUOTE **NOFOREACH**))
               (CDR **GENERATEBLIP**])
)
  (RPAQ **GENERATEBLIP**)
  (RPAQ **FOREACHPOS**)
  (RPAQ **FOREACHBLIP**)
(DEFLIST(QUOTE(
  (FOREACH (USERWORD . FOREACH))
))(QUOTE CLISPWORD))

(DEFLIST(QUOTE(
  [USE (LAMBDA (Z)
               (COND [(EQ (CAR **GENERATEBLIP**)
                          (QUOTE **NOFOREACH**))
                      (RPLACD **GENERATEBLIP** (CONS Z (CDR 
                                                   **GENERATEBLIP**]
                     (T (STKAPPLY* **GENERATEPOS** **GENERATEBLIP** Z]
  [GENERATE ((GENERATEFORM)
             (PROG ([**GENERATEBLIP** (OR **FOREACHBLIP**
                                          (CONS (QUOTE **NOFOREACH**]
                    (**FOREACHBLIP**)
                    (**GENERATEPOS** **FOREACHPOS**)
                    (**FOREACHPOS**))
                   GENERATEFORM
                   (AND (EQ (CAR **GENERATEBLIP**)
                            (QUOTE **NOFOREACH**))
                        (CDR **GENERATEBLIP**]
  [REGENERATE ((A)
               (PROG [(**FOREACHPOS** (CURPOS))
                      (**FOREACHBLIP** (FUNCTION (LAMBDA (**REGEN**)
                                                         (USE **REGEN**]
                     (MAPC A **FOREACHBLIP**]
  (FOREACH NIL)
))(QUOTE MACRO))

STOP